{% extends "base.html" %}

{% block headtitle %}Roles - {{ current_role_type_name }}{% endblock %}



{% block header_scripts %}
<script type="text/javascript" src="/m/js/lib/jquery.dataTables.js"></script>
<script type="text/javascript" src="/m/js/lib/jquery.jeditable.js"></script>
<script type="text/javascript" src="/m/js/lib/jquery.cluetip.js"></script>

<script type="text/javascript" src="/m/js/roles_table.js"></script>
<link rel="stylesheet" type="text/css" media="screen,projection,print" href="/m/css/jquery.dataTables.css" />
<link rel="stylesheet" type="text/css" media="screen,projection,print" href="/m/css/jquery.cluetip.css" />

<script type="text/javascript">
const COLOR_THRESHOLDS = {{ colorThresholds|safe }};
var current_role_type = "{{ current_role_type }}";
</script>
{% endblock %}


{% block breadcrumbs %}
<li><a href="/">Home</a></li>
<li><a href="/roles">Roles</a></li>
<li><a href="/roles/{{ current_role_type }}">{{ current_role_type_name }}</a></li>
{% endblock %}

{% block main_content %}
<h1 class="pagetitle">Roles <span class="time">- <span id="role_category">{{ current_role_type_name }}</span></span></h1>

<!-- buttons -->
<form id="role_categories" class="search_form">
{% for rt in role_types %}
    <input type="button" class="button{% if rt.typeName == current_role_type %} selected{% endif %}" 
           id="{{ rt.typeName }}_button" value="{{ rt.dispName }}" />
{% endfor %}
</form>

<!-- bind urls to the buttons -->
<script type="text/javascript">
{% for rt in role_types %}
$("#{{ rt.typeName }}_button").click(function() {
    window.location = "/roles/{{ rt.typeName }}";
});
{% endfor %}
</script>

<table class="table display" id="roles_table">
  <thead> 
    <tr>
      <th class="top" scope="col" >Role Name</th>
      <th class="top" scope="col" >Description</th>
      <th class="top" scope="col" >Access Level</th>
      <th class="top" scope="col" >Members</th>
      <th class="top" scope="col" >Titles</th>
      <th class="top" scope="col" style="display:none;"></th>
      <th class="top" scope="col" style="display:none;"></th>
      <th class="top" scope="col" style="display:none;"></th>
    </tr>
  </thead>
  <tbody> 
    <tr>
      <td colspan="5" class="dataTables_empty">Loading data from server...</td>
    </tr>
  </tbody> 
  <tfoot> 
    <tr>
      <th>Role Name</th>
      <th>Description</th>
      <th>Access Level</th>
      <th>Members</th>
      <th>Titles</th>
      <th style="display:none;"></th>
      <th style="display:none;"></th>
      <th style="display:none;"></th>
    </tr>
  </tfoot>
</table>


{% endblock %}
